package mediator;

public abstract class Speaker{

    public String name;
    protected AbstractBroadCast broadCast;
    public Speaker(String name, AbstractBroadCast broadCast) {
        this.name = name;
        this.broadCast = broadCast;
        this.broadCast.addHearer((HearAble) this);
    }

    public abstract void speak(String message);
    public  void speakTo(HearAble hearer,String message){
        System.out.println(this.name + "对"+ ((Speaker) hearer).name+"说：" + message);
        broadCast.sendTo(this,hearer,message);
    }
}
